package ipiwebprocess;

import ipiwebdao.jdbc.relaiDaoJdbc;
import ipiwebtransverse.IpiwebException;
import ipiwebtransverse.relai;

import java.util.ArrayList;
import java.util.List;

public class relaiProcess {
	
	
	private static relaiDaoJdbc sRelai = new relaiDaoJdbc();

	
	
	
	public void ajouterRelai(relai pRelai) throws IpiwebException {
		
		try{
			
			 sRelai.ajouterRelai(pRelai);
			
		} catch (Exception e) {
			throw new IpiwebException("Impossible d'obtenir la liste des relais", e);	
		
	}
	
	}	
		
		public List<relai> listerRelais() throws IpiwebException {
			
			
			
			List <relai> liste = new ArrayList<relai>();
	
			try {
				
				liste = sRelai.listerRelais();
				
			} catch (Exception e) {
				throw new IpiwebException("Impossible d'obtenir la liste des relais", e);
			}

			return liste;
			
		}
		
		
		public relai GetRelaiById (int pRelai_id) throws IpiwebException {
			
			try{
				return sRelai.GetRelaiById(pRelai_id);
				} catch (Exception e) {
				throw new IpiwebException("Impossible d'obtenir le relai", e);	
				}
		}	

		
		
		public void DesactiverRelai (relai pRelai) throws IpiwebException {
			try{
				sRelai.DesactiverRelai(pRelai);
				} catch (Exception e) {
				throw new IpiwebException("Impossible d'obtenir le relai", e);	
				}
			
		}
		
		
		public void modifierRelai(relai pRelai) throws IpiwebException {
			
			try{
				sRelai.modifierRelai(pRelai);
			} catch (Exception e) {
				throw new IpiwebException("Impossible d'obtenir le relai", e);	
				}
			
			
			
			
			
			
		}
		
  }
	
	
